package myky.com.doctorapp.model


import com.xiangyao.train.utils.RxScedulerHelper

import io.reactivex.Observable
import myky.com.doctorapp.api.ApiManager
import myky.com.doctorapp.base.BaseEntity
import myky.com.doctorapp.contract.LongRangeListFragmentContract
import myky.com.doctorapp.entity.LongRangeListEntity
import myky.com.doctorapp.utils.RequestBodyBuilder

/**
 * Description:
 *
 * @author wuyangwuyang
 * Created by 2019/3/8 on 11:13
 */
class LongRangeListFragmentModel : LongRangeListFragmentContract.Model {

    override fun remoteLists(total: String,statusId:String): Observable<BaseEntity<LongRangeListEntity.PayLoadBean>> {


    val builder = RequestBodyBuilder.Builder()

    builder.params("currAppStatus", statusId)
           .params("sortBy","createtime")
           .params("desc","true")

        //取消和已完成状态放到同一个列表里
        if(statusId == "2"){
             builder.params("currAppStatus", "3")
                    .params("currAppStatus", statusId)
                    .params("sortBy","createtime")
                    .params("desc","true")
        }
    val hashMap = builder.map
        return ApiManager.getApistore().remoteList(total,hashMap).compose(RxScedulerHelper.io_main())
    }
}
